<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MiXiM: D:/Projects/MiXiM/extsrc/mixim/src/base/modules/BaseMacLayer.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MiXiM
   &#160;<span id="projectnumber">2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('a00270.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">BaseMacLayer.h</div>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- mode:c++ -*- ********************************************************</span>
<a name="l00002"></a>00002 <span class="comment"> * file:        BaseMacLayer.h</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * author:      Daniel Willkomm</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> * copyright:   (C) 2004 Telecommunication Networks Group (TKN) at</span>
<a name="l00007"></a>00007 <span class="comment"> *              Technische Universitaet Berlin, Germany.</span>
<a name="l00008"></a>00008 <span class="comment"> *</span>
<a name="l00009"></a>00009 <span class="comment"> *              This program is free software; you can redistribute it</span>
<a name="l00010"></a>00010 <span class="comment"> *              and/or modify it under the terms of the GNU General Public</span>
<a name="l00011"></a>00011 <span class="comment"> *              License as published by the Free Software Foundation; either</span>
<a name="l00012"></a>00012 <span class="comment"> *              version 2 of the License, or (at your option) any later</span>
<a name="l00013"></a>00013 <span class="comment"> *              version.</span>
<a name="l00014"></a>00014 <span class="comment"> *              For further information see file COPYING</span>
<a name="l00015"></a>00015 <span class="comment"> *              in the top level directory</span>
<a name="l00016"></a>00016 <span class="comment"> ***************************************************************************</span>
<a name="l00017"></a>00017 <span class="comment"> * part of:     framework implementation developed by tkn</span>
<a name="l00018"></a>00018 <span class="comment"> * description: basic MAC layer class</span>
<a name="l00019"></a>00019 <span class="comment"> *              subclass to create your own MAC layer</span>
<a name="l00020"></a>00020 <span class="comment"> **************************************************************************/</span>
<a name="l00021"></a>00021 <span class="preprocessor">#ifndef BASE_MAC_LAYER_H</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span><span class="preprocessor">#define BASE_MAC_LAYER_H</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;omnetpp.h&gt;</span>
<a name="l00025"></a>00025 
<a name="l00026"></a>00026 <span class="preprocessor">#include &quot;MiXiMDefs.h&quot;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &quot;BaseLayer.h&quot;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &quot;SimpleAddress.h&quot;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &quot;MappingBase.h&quot;</span>
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="keyword">class </span><a class="code" href="a00019.html" title="Module to control the channel and handle all connection related stuff.">BaseConnectionManager</a>;
<a name="l00032"></a>00032 <span class="keyword">class </span>MacPkt;
<a name="l00033"></a>00033 <span class="keyword">class </span><a class="code" href="a00134.html" title="Defines the methods provided by the phy to the mac layer.">MacToPhyInterface</a>;
<a name="l00034"></a>00034 <span class="keyword">class </span><a class="code" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a>;
<a name="l00035"></a>00035 
<a name="l00045"></a><a class="code" href="a00026.html">00045</a> <span class="keyword">class </span>MIXIM_API <a class="code" href="a00026.html" title="A very simple MAC module template which provides de- and encapsulation of messages using the standard...">BaseMacLayer</a> : <span class="keyword">public</span> <a class="code" href="a00025.html" title="A very simple layer template.">BaseLayer</a>
<a name="l00046"></a>00046 {
<a name="l00047"></a>00047 <span class="keyword">public</span>:
<a name="l00048"></a>00048     <span class="keyword">typedef</span> MacPkt* macpkt_ptr_t;
<a name="l00050"></a><a class="code" href="a00026.html#a8f1f4f485d6548964c1f1cbd75d1d9c7">00050</a>     <span class="keyword">enum</span> <a class="code" href="a00026.html#a8f1f4f485d6548964c1f1cbd75d1d9c7" title="Message kinds used by this layer.">BaseMacMessageKinds</a> {
<a name="l00053"></a><a class="code" href="a00026.html#a8f1f4f485d6548964c1f1cbd75d1d9c7a0e31be8e59c319e75d7a9858ff984a2f">00053</a>         LAST_BASE_MAC_MESSAGE_KIND = 23000,
<a name="l00054"></a>00054     };
<a name="l00056"></a><a class="code" href="a00026.html#a49e0e548a6c20d002bd67afa7b76c483">00056</a>     <span class="keyword">enum</span> <a class="code" href="a00026.html#a49e0e548a6c20d002bd67afa7b76c483" title="Control message kinds used by this layer.">BaseMacControlKinds</a> {
<a name="l00058"></a><a class="code" href="a00026.html#a49e0e548a6c20d002bd67afa7b76c483a5e5e0e55f7cc75b0d8bad06a212371f1">00058</a>         TX_OVER = 23500,
<a name="l00060"></a><a class="code" href="a00026.html#a49e0e548a6c20d002bd67afa7b76c483adebf9c77bbe6f19772866cccbef0fe4b">00060</a>         <a class="code" href="a00026.html#a49e0e548a6c20d002bd67afa7b76c483adebf9c77bbe6f19772866cccbef0fe4b">PACKET_DROPPED</a>,
<a name="l00063"></a><a class="code" href="a00026.html#a49e0e548a6c20d002bd67afa7b76c483a914b2cf7aab4597589adb15d8fec8b18">00063</a>         <a class="code" href="a00026.html#a49e0e548a6c20d002bd67afa7b76c483a914b2cf7aab4597589adb15d8fec8b18">LAST_BASE_MAC_CONTROL_KIND</a>,
<a name="l00064"></a>00064     };
<a name="l00065"></a>00065 
<a name="l00066"></a>00066 <span class="keyword">protected</span>:
<a name="l00067"></a>00067 
<a name="l00069"></a><a class="code" href="a00026.html#aa7b1e6bdb734765a9f4eff7d486dfbea">00069</a>     <a class="code" href="a00134.html" title="Defines the methods provided by the phy to the mac layer.">MacToPhyInterface</a>* <a class="code" href="a00026.html#aa7b1e6bdb734765a9f4eff7d486dfbea" title="Handler to the physical layer.">phy</a>;
<a name="l00070"></a>00070 
<a name="l00072"></a>00072     <span class="comment">//BaseArp* arp;</span>
<a name="l00073"></a>00073 
<a name="l00077"></a><a class="code" href="a00026.html#a26ddb186455b73c8dc8b5698296804d2">00077</a>     <span class="keywordtype">long</span> <a class="code" href="a00026.html#a26ddb186455b73c8dc8b5698296804d2" title="Pointer to the arp module.">headerLength</a>;
<a name="l00078"></a>00078 
<a name="l00082"></a><a class="code" href="a00026.html#a8a26df9da07801d8ccb530530ef57ee2">00082</a>     <a class="code" href="a00117.html#aea56b60dcb5ae8c2bde465271daf7210" title="Type definition for a L2 (MAC) address.">LAddress::L2Type</a> <a class="code" href="a00026.html#a8a26df9da07801d8ccb530530ef57ee2" title="MAC address.">myMacAddr</a>;
<a name="l00083"></a>00083 
<a name="l00085"></a><a class="code" href="a00026.html#ab3111737703e0d4b5198478fb1f75e60">00085</a>     <span class="keywordtype">bool</span> <a class="code" href="a00026.html#ab3111737703e0d4b5198478fb1f75e60" title="debug this core module?">coreDebug</a>;
<a name="l00086"></a>00086 
<a name="l00094"></a><a class="code" href="a00026.html#ab54fe535cdac4d9ee526153163991b4d">00094</a>     <span class="keywordtype">long</span> <a class="code" href="a00026.html#ab54fe535cdac4d9ee526153163991b4d" title="The length of the phy header (in bits).">phyHeaderLength</a>;
<a name="l00095"></a>00095 
<a name="l00096"></a>00096 <span class="keyword">private</span>:
<a name="l00099"></a>00099     <a class="code" href="a00026.html" title="A very simple MAC module template which provides de- and encapsulation of messages using the standard...">BaseMacLayer</a>(<span class="keyword">const</span> <a class="code" href="a00026.html" title="A very simple MAC module template which provides de- and encapsulation of messages using the standard...">BaseMacLayer</a>&amp;);
<a name="l00102"></a>00102     <a class="code" href="a00026.html" title="A very simple MAC module template which provides de- and encapsulation of messages using the standard...">BaseMacLayer</a>&amp; <a class="code" href="a00025.html#a063fda133f5220b9db525cd32c6d683b" title="Assignment operator is not allowed.">operator=</a>(<span class="keyword">const</span> <a class="code" href="a00026.html" title="A very simple MAC module template which provides de- and encapsulation of messages using the standard...">BaseMacLayer</a>&amp;);
<a name="l00103"></a>00103 
<a name="l00104"></a>00104 <span class="keyword">public</span>:
<a name="l00105"></a>00105     <span class="comment">//Module_Class_Members( BaseMacLayer, BaseLayer, 0 );</span>
<a name="l00106"></a>00106     <a class="code" href="a00026.html" title="A very simple MAC module template which provides de- and encapsulation of messages using the standard...">BaseMacLayer</a>() 
<a name="l00107"></a>00107       : <a class="code" href="a00025.html" title="A very simple layer template.">BaseLayer</a>()
<a name="l00108"></a>00108       , phy(NULL)
<a name="l00109"></a>00109       , headerLength(0)
<a name="l00110"></a>00110       , myMacAddr(<a class="code" href="a00117.html" title="Layer address handling helper function.">LAddress</a>::L2NULL)
<a name="l00111"></a>00111       , coreDebug(false)
<a name="l00112"></a>00112       , phyHeaderLength(0)
<a name="l00113"></a>00113     {}
<a name="l00114"></a>00114     <a class="code" href="a00026.html" title="A very simple MAC module template which provides de- and encapsulation of messages using the standard...">BaseMacLayer</a>(<span class="keywordtype">unsigned</span> stacksize) 
<a name="l00115"></a>00115       : <a class="code" href="a00025.html" title="A very simple layer template.">BaseLayer</a>(stacksize)
<a name="l00116"></a>00116       , phy(NULL)
<a name="l00117"></a>00117       , headerLength(0)
<a name="l00118"></a>00118       , myMacAddr(<a class="code" href="a00117.html" title="Layer address handling helper function.">LAddress</a>::L2NULL)
<a name="l00119"></a>00119       , coreDebug(false)
<a name="l00120"></a>00120       , phyHeaderLength(0)
<a name="l00121"></a>00121     {}
<a name="l00122"></a>00122 
<a name="l00124"></a>00124     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a00025.html#a70f5ea30a9980d57b8384faed29ec3eb" title="Initialization of the module and some variables.">initialize</a>(<span class="keywordtype">int</span>);
<a name="l00125"></a>00125 
<a name="l00129"></a><a class="code" href="a00026.html#afc72edc0b6187b41d084195028b9b61a">00129</a>     <span class="keyword">const</span> <a class="code" href="a00117.html#aea56b60dcb5ae8c2bde465271daf7210" title="Type definition for a L2 (MAC) address.">LAddress::L2Type</a>&amp; <a class="code" href="a00026.html#afc72edc0b6187b41d084195028b9b61a" title="Returns the MAC address of this MAC module.">getMACAddress</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> myMacAddr; }
<a name="l00130"></a>00130 
<a name="l00131"></a>00131 <span class="keyword">protected</span>:
<a name="l00132"></a>00132 
<a name="l00136"></a>00136     <span class="keyword">virtual</span> <span class="keywordtype">void</span> registerInterface();
<a name="l00137"></a>00137 
<a name="l00148"></a>00148     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a00025.html#a8c0fcfb2e806357a65d5bdb1c338627b" title="Handle messages from upper layer.">handleUpperMsg</a>(cMessage *msg);
<a name="l00149"></a>00149 
<a name="l00154"></a>00154     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a00025.html#a5ca2278405070baa474dfbf059930247" title="Handle messages from lower layer.">handleLowerMsg</a>(cMessage *msg);
<a name="l00155"></a>00155 
<a name="l00156"></a><a class="code" href="a00026.html#add5277c1a60dab10db40c8d9641e48c4">00156</a>     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a00026.html#add5277c1a60dab10db40c8d9641e48c4" title="Handle self messages such as timer...">handleSelfMsg</a>(cMessage*) {
<a name="l00157"></a>00157   error(<span class="stringliteral">&quot;BaseMacLayer does not handle self messages&quot;</span>);
<a name="l00158"></a>00158     }
<a name="l00159"></a>00159     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a00025.html#aa37925527fae20a5de1a755103056219" title="Handle control messages from lower layer.">handleLowerControl</a>(cMessage* msg);
<a name="l00160"></a>00160 
<a name="l00161"></a><a class="code" href="a00026.html#ae4679596514426f66e66cb5ca9c29275">00161</a>     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a00026.html#ae4679596514426f66e66cb5ca9c29275" title="Handle control messages from upper layer.">handleUpperControl</a>(cMessage*) {
<a name="l00162"></a>00162   error(<span class="stringliteral">&quot;BaseMacLayer does not handle control messages from upper layers&quot;</span>);
<a name="l00163"></a>00163     }
<a name="l00164"></a>00164 
<a name="l00166"></a>00166     <span class="keyword">virtual</span> cPacket* decapsMsg(macpkt_ptr_t);
<a name="l00167"></a>00167 
<a name="l00169"></a>00169     <span class="keyword">virtual</span> macpkt_ptr_t encapsMsg(cPacket*);
<a name="l00170"></a>00170 
<a name="l00186"></a>00186     <span class="keyword">virtual</span> <a class="code" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a>* createSignal(simtime_t_cref start, simtime_t_cref length, <span class="keywordtype">double</span> power, <span class="keywordtype">double</span> bitrate);
<a name="l00187"></a>00187 
<a name="l00194"></a>00194     <a class="code" href="a00136.html" title="Represents a changeable mapping (mathematical function) from at least time to Argument::mapped_type.">Mapping</a>* createConstantMapping(simtime_t_cref start, simtime_t_cref end, Argument::mapped_type_cref value);
<a name="l00195"></a>00195 
<a name="l00202"></a>00202     <a class="code" href="a00136.html" title="Represents a changeable mapping (mathematical function) from at least time to Argument::mapped_type.">Mapping</a>* createRectangleMapping(simtime_t_cref start, simtime_t_cref end, Argument::mapped_type_cref value);
<a name="l00203"></a>00203 
<a name="l00208"></a>00208     <a class="code" href="a00058.html" title="Represents a not changeable mapping (mathematical function) from domain with at least the time to a A...">ConstMapping</a>* createSingleFrequencyMapping(simtime_t_cref start, simtime_t_cref end, Argument::mapped_type_cref centerFreq, Argument::mapped_type_cref bandWith, Argument::mapped_type_cref value);
<a name="l00209"></a>00209 
<a name="l00214"></a>00214     <a class="code" href="a00019.html" title="Module to control the channel and handle all connection related stuff.">BaseConnectionManager</a>* getConnectionManager() <span class="keyword">const</span>;
<a name="l00215"></a>00215 
<a name="l00224"></a>00224     <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="a00117.html#aea56b60dcb5ae8c2bde465271daf7210" title="Type definition for a L2 (MAC) address.">LAddress::L2Type</a>&amp; getUpperDestinationFromControlInfo(<span class="keyword">const</span> cObject *<span class="keyword">const</span> pCtrlInfo) <span class="keyword">const</span>;
<a name="l00225"></a>00225 
<a name="l00239"></a>00239     <span class="keyword">virtual</span> cObject* setUpControlInfo(cMessage *<span class="keyword">const</span> pMsg, <span class="keyword">const</span> <a class="code" href="a00117.html#aea56b60dcb5ae8c2bde465271daf7210" title="Type definition for a L2 (MAC) address.">LAddress::L2Type</a>&amp; pSrcAddr);
<a name="l00253"></a>00253     <span class="keyword">virtual</span> cObject* setDownControlInfo(cMessage *<span class="keyword">const</span> pMsg, <a class="code" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a> *<span class="keyword">const</span> pSignal);
<a name="l00254"></a>00254 
<a name="l00257"></a><a class="code" href="a00026.html#ae51d8e3e0977cfc1d4f10f8135378fc4">00257</a>     <span class="keyword">const</span> cModule* getNic()<span class="keyword"> const</span>
<a name="l00258"></a>00258 <span class="keyword">    </span>{
<a name="l00259"></a>00259         <span class="keywordflow">return</span> getParentModule();
<a name="l00260"></a>00260     }
<a name="l00261"></a>00261     cModule* getNic()
<a name="l00262"></a>00262     {
<a name="l00263"></a>00263         <span class="keywordflow">return</span> getParentModule();
<a name="l00264"></a>00264     }
<a name="l00265"></a>00265 };
<a name="l00266"></a>00266 
<a name="l00267"></a>00267 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><b>BaseMacLayer.h</b>      </li>

    <li class="footer">Generated on Tue Mar 5 2013 21:26:29 for MiXiM by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
